<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->

<lv-form [lvLabelColon]="false" class="formGroup">
  <ng-container *ngIf="isOceanProtect || isCyberengine">
    <lv-form-item>
      <lv-form-label>{{ 'common_type_label' | i18n }}</lv-form-label>
      <lv-form-control>
        {{ user.userType | textMap: 'loginUserType' }}
      </lv-form-control>
    </lv-form-item>
    <ng-container *ngIf="user.userType === dataMap.loginUserType.local.value">
      <lv-form-item>
        <lv-form-label>{{ 'common_login_method_label' | i18n }}</lv-form-label>
        <lv-form-control>
          {{ user.loginType | textMap: 'loginMethod' }}
        </lv-form-control>
      </lv-form-item>
      <lv-form-item *ngIf="user.loginType === dataMap.loginMethod.email.value">
        <lv-form-label>{{ 'system_recipient_email_address_label' | i18n }}</lv-form-label>
        <lv-form-control>
          {{dynamicCodeEmail | nil}}
          <i lv-icon="{{ eyeIcon }}" lvTooltipPosition="rightTop" lvTooltipTheme="light" class="configform-constraint"
            lvColorState="true" (click)="changeEmail()"></i>
        </lv-form-control>
      </lv-form-item>
    </ng-container>
  </ng-container>
  <lv-form-item>
    <lv-form-label>{{ 'common_role_label' | i18n }}</lv-form-label>
    <lv-form-control>
      {{ userRoleI18nMap[userRoleType[user.rolesSet[0].roleId + '']] | i18n }}
    </lv-form-control>
  </lv-form-item>
  <lv-form-item>
    <lv-form-label>{{ 'common_status_label' | i18n }}</lv-form-label>
    <lv-form-control>
      <aui-status [value]="user.login" type="User_Login_Status"></aui-status>
    </lv-form-control>
  </lv-form-item>
  <lv-form-item>
    <lv-form-label>{{ 'common_lock_status_label' | i18n }}</lv-form-label>
    <lv-form-control>
      {{ user.lock | textMap: 'USRE_LOCK' }}
    </lv-form-control>
  </lv-form-item>
  <lv-form-item>
    <lv-form-label>{{ 'common_desc_label' | i18n }}</lv-form-label>
    <lv-form-control>
      <div style="width: 350px;" lv-overflow>
        {{user.description | nil}}
      </div>
    </lv-form-control>
  </lv-form-item>
  <lv-form-item>
    <lv-form-label>{{'system_user_maxconnections_label' | i18n }}</lv-form-label>
    <lv-form-control>
      {{ user.sessionControl ? user.sessionLimit: '--' }}
    </lv-form-control>
  </lv-form-item>
  <lv-form-item *ngIf="user.rolesSet[0].roleId === 7">
    <lv-form-label>{{'system_password_no_time_limit_label' | i18n }}</lv-form-label>
    <lv-form-control>
      {{ user.neverExpire | textMap: 'Switch_Status' }}
    </lv-form-control>
  </lv-form-item>
</lv-form>

<ng-template #headerTpl>
  <aui-custom-modal-operate [item]="user"></aui-custom-modal-operate>
</ng-template>